package org.setec.config;

import org.setec.utils.io.Persistance;

import java.lang.reflect.Method;

public class InterpretableConfiguration extends Configuration {

    public boolean isProcessRealMethod(String className, String methodName, Object[] args) {
        if (getMode() == Mode.LEARN ||
                getMode() == Mode.PASS) {
            return true;
        }

        if (getMode() == Mode.AUTO) {
            return !Persistance.persists(getStorage(), className, methodName, args);
        }

        return false;
    }

    public boolean isLearn(String className, String methodName, Object[] args) {
        if (getMode() == Mode.LEARN) {
            return true;
        }

        if (getMode() == Mode.AUTO) {
            return !Persistance.persists(getStorage(), className, methodName, args);
        }

        return false;
    }

    public boolean isMock(String className, String methodName, Object[] args) {
        if( getMode()==Mode.MOCK ) {
            return true;
        }
        if( getMode()== Mode.AUTO ) {
            Persistance.persists(getStorage(), className, methodName, args);
        }
        return false;
    }

}
